package es.ceura.wilder.controllers;

import es.ceura.wilder.configuration.Config;
import es.ceura.wilder.handlers.RequestHandler;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 *
 * @author Jorge Madrid
 */
public class Controller {

    ExecutorService threadPool;

    public Controller() {
        int maxThreads = Integer.parseInt(Config.INSTANCE.getConfigVar(Config.MAX_THREADS));
        threadPool = Executors.newFixedThreadPool(maxThreads);
    }

    public void delegatePetition(Socket clientSocket) {
        //Submit Runnable to thread pool...
        threadPool.submit(new RequestHandler(clientSocket));
    }
}
